<?php
date_default_timezone_set("PRC");
class CallBack{

    public function writeLog($action, $data){
        $data = is_array($data) ? json_encode($data, JSON_UNESCAPED_UNICODE) : $data;
        $date = date('Ymd');
        $log = "./logs/texlog/{$date}/{$date}_request_log.txt";
        $path = dirname($log);
        if(!file_exists($path)){
            mkdir(iconv("UTF-8", "GBK", $path), 0777, 'true');
        }

        $fopen = fopen($log, 'a'); //打开文件资源通道，不存在则创建
        fwrite($fopen, var_export(date('YmdHis').'_'.$action.'_:'.$data, true)."\n\r");//将值写入文件
        fclose($fopen);
    }
}

$data = file_get_contents("php://input");

$model = new CallBack();
$model->writeLog('支付回调参数：_'.__LINE__, $data);
echo  json_encode(['code' => 0, 'msg' => 'ok']);

